﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DesignByContract.CodeContracts
{
    class Program
    {
        static void Main(string[] args)
        {
            SimpleExample();

            InheritanceExample();

            InterfaceExample();

            Console.ReadKey();
        }

        public static void SimpleExample()
        {
            CEL CEL = new CEL("0001");

            // Interest rate is too high
            CEL.ComputeInterest(100, 2);
            
            // Amount will be lower after interest
            CEL.ComputeInterest(100, -0.45);

            // Invariant minimum will not be correct
            CEL.ComputeInterest(100, 0.5, 0);

            // Invariant ContractID will not be correct
            CEL CEL2 = new CEL("1");                       
        }

        public static void InheritanceExample()
        {
            LivretA LivretA = new LivretA();

            // Interest rate is too high
            LivretA.ComputeInterest(100, 2);

            // Interest rate is too low
            LivretA.ComputeInterest(100, -0.45);
        }

        public static void InterfaceExample()
        {
            LDD LDD = new LDD();

            // Interest rate is too high
            LDD.ComputeInterest(10, 2);

            // Amount will be lower after interest
            LDD.ComputeInterest(100, -0.45);
        }
    }
}
